package cn.wx.common.unitofwork.entity;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableName;

import cn.wx.common.persistence.base.BaseEntity;
import cn.wx.common.utils.JSONUtils;

@TableName("biz_log_event")
public class BizEvent extends BaseEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long sagaId;
	
	/**
	 * 事件所属流程
	 */
	private String saga;


	/**
	 * 创建时间
	 */
	private Date createDate;

	/**
	 * 所需要的业务数据JSON
	 */
	private String payload;

	/**
	 * 来自哪个项目
	 */
	private String project;

	/**
	 * 来自哪个部署环境
	 */
	private String environment;

	/**
	 * 耗时
	 */
	private Double consutime;
	
	/**
	 * 执行是否有异常
	 */
	private Boolean consuOk;
	
	/**
	 * 开发人员
	 */
	public BizEvent() {
		super();
	}

	public BizEvent(Long sagaId, String saga, Object payload, String project,String environment) {
		super();
		this.saga = saga;
		this.sagaId = sagaId;
		/**
		 * 插入es
		 * this.payload = (T)JSONUtils.c(payload);
		 */
		this.payload = JSONUtils.c(payload);
		this.project = project;
		this.environment = environment;
		this.createDate = new Date();
	}

	public String getSaga() {
		return saga;
	}

	public void setSaga(String saga) {
		this.saga = saga;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getPayload() {
		return payload;
	}

	public void setPayload(String payload) {
		this.payload = payload;
	}

	public String getProject() {
		return project;
	}

	public void setProject(String project) {
		this.project = project;
	}

	public String getEnvironment() {
		return environment;
	}

	public void setEnvironment(String environment) {
		this.environment = environment;
	}

	public Double getConsutime() {
		return consutime;
	}

	public void setConsutime(Double consutime) {
		this.consutime = consutime;
	}

	public Boolean getConsuOk() {
		return consuOk;
	}

	public void setConsuOk(Boolean consuOk) {
		this.consuOk = consuOk;
	}

	public Long getSagaId() {
		return sagaId;
	}

	public void setSagaId(Long sagaId) {
		this.sagaId = sagaId;
	}

}
